﻿<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
		<script type="text/javascript">
			window.onload = function(){
				//这个获取的是伪数组，尽量不要使用for-in遍历
				var btnlist = document.getElementsByTagName("button");
				/*
				for(var i=0; i<btnlist.length; i++){
					btnlist[i].index = i;
					btnlist[i].onclick = function(){
						alert( this.innerHTML );
					}
				}
				setTimeout(btnlist[0].onclick, 5000);
				*/
			
				//console.log(btnlist.length)
			}
			
		
		</script>
     </head>
    <body>
		<button id="btn1">按钮</button>
		<button id="btn2">按钮</button>
		<button id="btn3">按钮</button>
		<button id="btn4">按钮</button>
		<button id="btn5">按钮</button>
    </body>
</html>
